package shmallarchitect.jpa.entities;
// Generated 2009-08-23 21:22:13 by Hibernate Tools 3.2.1.GA


import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Card generated by hbm2java
 */
@Entity
@Table(name="card"
    ,catalog="shmall_architect"
)
public class Card  implements java.io.Serializable {


     private Long id;
     private String textualDesc;
     private String www;
     private String phone;
     private Set<Resource> resources = new HashSet<Resource>(0);
     private Set<Locum> locums = new HashSet<Locum>(0);

    public Card() {
    }

    public Card(String textualDesc, String www, String phone, Set<Resource> resources, Set<Locum> locums) {
       this.textualDesc = textualDesc;
       this.www = www;
       this.phone = phone;
       this.resources = resources;
       this.locums = locums;
    }
   
     @Id @GeneratedValue(strategy=IDENTITY)
    
    @Column(name="id", unique=true, nullable=false)
    public Long getId() {
        return this.id;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    
    @Column(name="textual_desc")
    public String getTextualDesc() {
        return this.textualDesc;
    }
    
    public void setTextualDesc(String textualDesc) {
        this.textualDesc = textualDesc;
    }
    
    @Column(name="www")
    public String getWww() {
        return this.www;
    }
    
    public void setWww(String www) {
        this.www = www;
    }
    
    @Column(name="phone")
    public String getPhone() {
        return this.phone;
    }
    
    public void setPhone(String phone) {
        this.phone = phone;
    }
@ManyToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY)
    @JoinTable(name="cardresource", catalog="shmall_architect", joinColumns = { 
        @JoinColumn(name="card_id", nullable=false, updatable=false) }, inverseJoinColumns = { 
        @JoinColumn(name="resource_id", nullable=false, updatable=false) })
    public Set<Resource> getResources() {
        return this.resources;
    }
    
    public void setResources(Set<Resource> resources) {
        this.resources = resources;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="card")
    public Set<Locum> getLocums() {
        return this.locums;
    }
    
    public void setLocums(Set<Locum> locums) {
        this.locums = locums;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Card other = (Card) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 43 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "card-" + id;
    }




}


